package com.jie.tcp;


import java.io.IOException;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
;

/**
 * 客户端
 * 网络编程
 */
public class TcpClient {
    public static void main(String[] args) {
        OutputStream outputStream = null;
        Socket socket = null;
        try {
            //要知道ip 端口号
            InetAddress severIp = InetAddress.getByName("127.0.0.1");
            int port = 9999;
            socket = new Socket(severIp,port);
            outputStream = socket.getOutputStream();
            outputStream.write("表妹表妹".getBytes());
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                outputStream.close();
                socket.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
